import 'package:flutter/material.dart';
import 'package:xin_nuo_pda/home/index/IndexPage.dart';
import 'package:xin_nuo_pda/tab/CategoryPage.dart';
import 'package:get/get.dart';
import 'package:xin_nuo_pda/values/constant.dart';

import 'TabsController.dart';


class TabsPage extends StatelessWidget {
  final TabsController logic = Get.put(TabsController());
  final pageList = [IndexPage(), CategoryPage()];

  @override
  Widget build(BuildContext context) {
    return Center(
      child: GetBuilder<TabsController>(
        builder: (logicGet) => Scaffold(
          appBar: AppBar(title: Text(USER),
              automaticallyImplyLeading:false),
          body: pageList[logic.currentIndex],
          bottomNavigationBar: BottomNavigationBar(
            type: BottomNavigationBarType.fixed,
            currentIndex: logic.currentIndex,
            onTap: (index) {
              logic.setIndex(index);
            },
            selectedItemColor: Colors.blue,
            unselectedItemColor: Colors.grey,
            items: [
              BottomNavigationBarItem(
                icon: Icon(Icons.home),
                label: "主页",
              ),
              BottomNavigationBarItem(
                icon: Icon(Icons.category),
                label: "查询",
              ),
              // BottomNavigationBarItem(
              //   icon: Icon(Icons.devices_other),
              //   label: "其他",
              // ),
              // BottomNavigationBarItem(
              //   icon: Icon(Icons.money),
              //   label: "我的",
              // )
            ],
          ),
        ),
      ),
    );
  }
}
